package com.gm.wholesale.module.good.view;
import android.app.Dialog;
import android.content.Context;
import android.text.InputFilter;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.gm.commonlib.filters.InputFilterEmoji;
import com.gm.commonlib.views.dialog.InputDialog;
import com.gm.wholesale.R;
public class CreateGoodNtDialogView extends Dialog implements View.OnClickListener {
    private TextView text1;
    private TextView text2;
    private TextView cancleTv;
    private OnFunctionListener listener;

    public interface OnFunctionListener {
        void onItem1Click();

        void onItem2Click();

        void onItem3Click();
    }

    public void setOnFunctionListener(OnFunctionListener listener) {
        this.listener = listener;
    }

    public CreateGoodNtDialogView(Context context) {
        this(context, true);
    }

    public CreateGoodNtDialogView(Context context, boolean canOutSideDissMiss) {
        super(context, com.gm.commonlib.R.style.alert_dialog);
        setCanceledOnTouchOutside(canOutSideDissMiss);
        initView();
    }

    private void initView() {
        setContentView(R.layout.view_create_good_dialog);
        text1 = findViewById(R.id.text1);
        text2 = findViewById(R.id.text2);
        cancleTv = findViewById(R.id.cancleTv);
        text1.setOnClickListener(this);
        text2.setOnClickListener(this);
        cancleTv.setOnClickListener(this);
    }


    @Override
    public void onClick(View view) {
        dismiss();
        if (view.getId() == R.id.text1) {
            listener.onItem1Click();
        } else if (view.getId() == R.id.text2) {
            listener.onItem2Click();
        } else if (view.getId() == R.id.cancleTv) {
            listener.onItem3Click();
        }

    }

    public void show(OnFunctionListener listener){
        this.listener=listener;
        show();
    }
}
